@extends("layouts.backend.webadmin")

@section('content')
<link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/jquery-treetable/css/jquery.treetable.css">

<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <a class="btn btn-primary cate-add" href="{{ URL::route('admin.flaw.add') }}" role="button"><i class="fa fa-plus-square" aria-hidden="true"></i> 增加</a>
                    <a class="btn btn-warning cate-restore" href="{{ URL::route('admin.flaw.index',['type'=>1]) }}" role="button"><i class="fa fa-trash-o" aria-hidden="true"></i> 回收站</a>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <table id="example1" class="table table-bordered table-striped">
                        <thead>
                        <tr>
<!--                            <th>#</th>-->
<!--                            <th>栏目层级</th>-->
                            <th>分类名称</th>
                            <th>分类标题</th>
                            <th>关键词</th>
                            <th>增加时间</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @forelse ($categorys as $ct)
                        <tr data-tt-id="{{$ct->id}}" data-tt-parent-id="{{$ct->pid}}">
<!--                            <td>{{$ct->id}}</td>-->
<!--                            <td>{{$ct->num}}</td>-->
                            <td>{!! $ct->pid==0?'<i class="fa fa-caret-down" aria-hidden="true"></i>':'' !!}{{$ct->name}}</td>
                            <td>{{$ct->title}}</td>
                            <td>{{$ct->keywords}}</td>
                            <td>{{$ct->created_at}}</td>
                            <td>{{$ct->updated_at}}</td>
                            <td>
                                @if($type==0)
                                <a class="btn btn-primary cate-update" href="{{ URL::route('admin.flaw.update',['id'=>$ct->id]) }}" role="button"><i class="fa fa-pencil fa-fw"></i>编辑</a>
                                <a class="btn btn-danger cate-delete" href="{{ URL::route('admin.flaw.del',['id'=>$ct->id]) }}" role="button"><i class="fa fa-trash-o fa-fw"></i>删除</a>
                                @else
                                    <a class="btn btn-primary cate-restore" href="{{ URL::route('admin.flaw.caterestore',['id'=>$ct->id]) }}" role="button"><i class="fa fa-pencil fa-fw"></i>恢复</a>
                                    <a class="btn btn-danger cate-forcedel" href="{{ URL::route('admin.flaw.cateforcedel',['id'=>$ct->id]) }}" role="button"><i class="fa fa-trash-o fa-fw"></i>彻底删除</a>
                                @endif
                            </td>
                        </tr>
                        @empty
                            <tr>
                                <td colspan="6" align="center">暂无数据！</td>
                            </tr>
                        @endforelse
                        </tbody>
                        <tfoot>
                        <!--<tr>
                            <th>#</th>
                            <th>栏目层级</th>
                            <th>分类名称</th>
                            <th>分类标题</th>
                            <th>关键词</th>
                            <th>增加时间</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>-->
                        </tfoot>
                    </table>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</section>
<!-- /.content -->
@stop

@section('javascript-end')
    <script src="{{env('APP_ROOT')}}/assets/jquery-treetable/js/jquery.treetable.js"></script>
    <script>
        //        $('#example1').DataTable()
        /*$('#example1').DataTable({
            'paging'      : true,
            'lengthChange': false,
            'searching'   : false,
            'ordering'    : false,
            'info'        : true,
            'autoWidth'   : true,
            'pagingType': "simple_numbers",  //分页样式：simple,simple_numbers,full,full_numbers
            'oLanguage'     :{
                "sInfo": "当前第 _PAGE_ 页,共 _PAGES_ 页,总条数 _TOTAL_ ",
                "oPaginate": {

                    "sFirst": "首页",
                    "sPrevious": "上页",
                    "sNext": "下页",
                    "sLast": "末页",
                    "sJump": "跳转"
                }
            }
        });*/
        $('#example1').treetable({"expandable":true,"initialState":"expanded"});
    </script>
@endsection